const MenuModel = require("../model/MenuModel")

// 查找数据库匹配用户
const MenuService = {
    find: (menuInfo = {}) => {
        return MenuModel.find(Object.assign(menuInfo)).sort({ sort: 1 })
    },
    append: (menuInfo) => {
        return MenuModel.create(menuInfo)
    },
    update: (menuInfo) => {
        return MenuModel.updateOne({ _id: menuInfo._id }, menuInfo)
    },
    remove: (id) => {
        return MenuModel.deleteOne({ _id: id })
    },
}
module.exports = MenuService